|
B.A.R.G.A.M.E.
v2.0
El Farol Bar Problem Implementation
|
Public Member Functions | |
| Form2 (double numagents, int numbars1, int barcap[], bool ispercentcap, int *loading) | |
| Form2 Constructor. | |
| ~Form2 () | |
| Form2 Destructor. | |
Protected Member Functions | |
| delegate void | SetTextDelegate (String^ text) |
| Delegate for thread safety. | |
| void | runner (double *data) |
| Chart Method. | |
| void | winningbars (double data[], int size, int leftorright) |
| Winning Bars Method. | |
| void | winners (double data[], int size, int leftorright) |
| Winners Method. | |
| void | avgstratscores (double data[], int size, int leftorright) |
| Average Strategy Scores Method. | |
| void | beststrat (double data[], int size, int leftorright) |
| Best Strategy Method. | |
| void | bardist (double data[], int size, int leftorright) |
| Bar Distribution Method. | |
| void | numdeaths (double data[], int size, int leftorright) |
| Number of Deaths Method. | |
| void | agedist (double data[], int size, int leftorright) |
| Age Distribution Method. | |
| System::Void | button2_Click (System::Object^ sender, System::EventArgs^ e) |
| Start/Resume Simulation Button. | |
| void | ThreadProcSafe () |
| Backend Method. | |
| void | SetText (String^ text) |
| Round Number Method. | |
| void | MarshalString (String^ s, string &os) |
| Marshal String Method. | |
| void | ComboBox1_SelectedIndexChanged (Object^ sender, System::EventArgs^ e) |
| Left Drop-down Event. | |
| void | ComboBox2_SelectedIndexChanged (Object^ sender, System::EventArgs^ e) |
| Right Drop-down Event. | |
| System::Void | Form2_FormClosed (System::Object^ sender, System::Windows::Forms::FormClosedEventArgs^ e) |
| Form2 Close Event. | |
Protected Attributes | |
| String^ | filename |
| String that holds output file name. | |
| int | numbars |
| Integer which holds number of bars. | |
| int | sleepytime |
| Integer which holds speed of round. | |
| int | selectedindex1 |
| Integer which represents left side of displayed chart. | |
| int | selectedindex2 |
| Integer which represents right side of displayed chart. | |
| int | stop |
| Integer that tells the thread to stop. | |
| int | turn |
| Integer which holds current round number. | |
| Town * | town |
| Town pointer used for backend. | |
| double * | ultimategraph |
| Array which holds all data needed for all charts. Offsets are used to give specific data to chart methods. | |
| graphPtr | t |
| graphPtr object used for backend. | |
| Thread^ | backendthread |
| Thread which backend is run on. | |
| BARGAME::Form2::Form2 | ( | double | numagents, |
| int | numbars1, | ||
| int | barcap[], | ||
| bool | ispercentcap, | ||
| int * | loading | ||
| ) |
Form2 Constructor.
Description: Initializes the components of Form2 and private variables with default values, and calls Town's constructor with input data from Simulation Button.
| numagents | Number of agents |
| numbars1 | Number of bars |
| barcap[] | Array holding bar capacities |
| ispercentcap | Bool representing if capacity is of type percent |
| *loading | Integer used for progress bar that gives a percent of completion |
| void BARGAME::Form2::agedist | ( | double | data[], |
| int | size, | ||
| int | leftorright | ||
| ) | [protected] |
Age Distribution Method.
Description: This method uses the ChartDirector API to create the graph for "Age Distribution" option.
| data | Array which holds data for charts. |
| size | Number of elements to be passed to ChartDirector API. |
| leftorright | Integer which tells the method to display graph on either right or left side of GUI. |
| void BARGAME::Form2::avgstratscores | ( | double | data[], |
| int | size, | ||
| int | leftorright | ||
| ) | [protected] |
Average Strategy Scores Method.
Description: This method uses the ChartDirector API to create the graph for "Average Score of All Strategies" option.
| data | Array which holds data for charts. |
| size | Number of elements to be passed to ChartDirector API. |
| leftorright | Integer which tells the method to display graph on either right or left side of GUI. |
| void BARGAME::Form2::bardist | ( | double | data[], |
| int | size, | ||
| int | leftorright | ||
| ) | [protected] |
Bar Distribution Method.
Description: This method uses the ChartDirector API to create the graph for "Wins per Bar" option.
| data | Array which holds data for charts. |
| size | Number of elements to be passed to ChartDirector API. |
| leftorright | Integer which tells the method to display graph on either right or left side of GUI. |
| void BARGAME::Form2::beststrat | ( | double | data[], |
| int | size, | ||
| int | leftorright | ||
| ) | [protected] |
Best Strategy Method.
Description: This method uses the ChartDirector API to create the graph for "Best Strategy's Scores" option.
| data | Array which holds data for charts. |
| size | Number of elements to be passed to ChartDirector API. |
| leftorright | Integer which tells the method to display graph on either right or left side of GUI. |
| System::Void BARGAME::Form2::button2_Click | ( | System::Object^ | sender, |
| System::EventArgs^ | e | ||
| ) | [protected] |
Start/Resume Simulation Button.
Description: Button that retrieves speed and selected dropdown options and starts thread to run backend. Also acts as a pause button which stops and starts backend thread.
| void BARGAME::Form2::ComboBox1_SelectedIndexChanged | ( | Object^ | sender, |
| System::EventArgs^ | e | ||
| ) | [protected] |
Left Drop-down Event.
Description: Event that changes displayed chart type when new chart is selected.
| void BARGAME::Form2::ComboBox2_SelectedIndexChanged | ( | Object^ | sender, |
| System::EventArgs^ | e | ||
| ) | [protected] |
Right Drop-down Event.
Description: Event that changes displayed chart type when new chart is selected.
| System::Void BARGAME::Form2::Form2_FormClosed | ( | System::Object^ | sender, |
| System::Windows::Forms::FormClosedEventArgs^ | e | ||
| ) | [protected] |
| void BARGAME::Form2::MarshalString | ( | String^ | s, |
| string & | os | ||
| ) | [protected] |
Marshal String Method.
Description: Method that converts System::String^ variable to string varib=able.
| text | String containing current round number. |
| void BARGAME::Form2::numdeaths | ( | double | data[], |
| int | size, | ||
| int | leftorright | ||
| ) | [protected] |
Number of Deaths Method.
Description: This method uses the ChartDirector API to create the graph for "Number of Deaths" option.
| data | Array which holds data for charts. |
| size | Number of elements to be passed to ChartDirector API. |
| leftorright | Integer which tells the method to display graph on either right or left side of GUI. |
| void BARGAME::Form2::runner | ( | double * | data | ) | [protected] |
Chart Method.
Description: This method calls corresponding methods to create charts based on what is selected from dropdowns.
| *data | Array which holds data for charts. |
| void BARGAME::Form2::SetText | ( | String^ | text | ) | [protected] |
Round Number Method.
Description: Method that updates current round number in real time.
| text | String containing current round number. |
| delegate void BARGAME::Form2::SetTextDelegate | ( | String^ | text | ) | [protected] |
Delegate for thread safety.
| void BARGAME::Form2::ThreadProcSafe | ( | ) | [protected] |
Backend Method.
Description: Method passed to thread that runs backend, updates speed if changed, creates data for graphs, calls runner method, and dumps graph data to output file.
| void BARGAME::Form2::winners | ( | double | data[], |
| int | size, | ||
| int | leftorright | ||
| ) | [protected] |
Winners Method.
Description: This method uses the ChartDirector API to create the graph for "Number of Winners" option.
| data | Array which holds data for charts. |
| size | Number of elements to be passed to ChartDirector API. |
| leftorright | Integer which tells the method to display graph on either right or left side of GUI. |
| void BARGAME::Form2::winningbars | ( | double | data[], |
| int | size, | ||
| int | leftorright | ||
| ) | [protected] |
Winning Bars Method.
Description: This method uses the ChartDirector API to create the graph for "Number of Bars that Won" option.
| data | Array which holds data for charts. |
Thread ^ BARGAME::Form2::backendthread [protected] |
Thread which backend is run on.
String ^ BARGAME::Form2::filename [protected] |
String that holds output file name.
int BARGAME::Form2::numbars [protected] |
Integer which holds number of bars.
int BARGAME::Form2::selectedindex1 [protected] |
Integer which represents left side of displayed chart.
int BARGAME::Form2::selectedindex2 [protected] |
Integer which represents right side of displayed chart.
int BARGAME::Form2::sleepytime [protected] |
Integer which holds speed of round.
int BARGAME::Form2::stop [protected] |
Integer that tells the thread to stop.
graphPtr BARGAME::Form2::t [protected] |
graphPtr object used for backend.
Town* BARGAME::Form2::town [protected] |
Town pointer used for backend.
int BARGAME::Form2::turn [protected] |
Integer which holds current round number.
double* BARGAME::Form2::ultimategraph [protected] |
Array which holds all data needed for all charts. Offsets are used to give specific data to chart methods.
1.8.0